﻿using System;
using Accountant.DataModel;
using Caliburn.Micro;

namespace Accountant.Primitives
{
  public class Money : PropertyChangedBase
  {
    public decimal Amount { get; private set; }
    public Currency Currency { get; private set; }

    public Money(Currency currency, decimal amount)
    {
      Amount = amount;
      Currency = currency;
    }
    public override string ToString()
    {
      switch (Currency.SymbolPosition)
      {
        case SymbolPosition.Prepend:
          return Currency.Symbol + Amount.ToString("N");
        case SymbolPosition.Append:
          return Amount.ToString("N") + Currency.Symbol;
        default:
          throw new NotSupportedException();
      }
    }
  }
}